<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<%@include file="frame/common.jsp"%>

<title>API订阅申请</title>
<style>
.applyinfo {
	padding: 20px 0;
}

.nav-tabs>li.active>a {
	background-color: #E6E5E5;
}

.form-horizontal .control-label {
	text-align: left;
}

.form-horizontal textarea {
	resize: none;
}

#tenantInfoTable table tbody tr td:nth-child(odd) {
	vertical-align: middle;
	text-align: center;
}
</style>
<script type="text/javascript"></script>
<script >
$(function(){
	loadSubscribeList();
}) 

function loadSubscribeList(){
	
	var username = $("#subName").val();
	var apiApproveStatus = $("#apiStatus option:selected").val();
	var apiName = $("#apiName").val();
	var url = ctx+"/apiApproveInfoResult";
	var param={"subscriber":username,"apiApproveStatus":apiApproveStatus,"apiName":apiName};
	jqList.query(url,param, function(data){
		if(data.status == 200) {
        	var itemsHtml = '';
        	var len = data.list.length;
        	if(len == 0){
        		itemsHtml = '<tr><td colspan="6">无数据...</td></tr>';
        	}
        	for(var i=0; i<len; i++){
        		(function(){
        			var sub = data.list[i];
        			if(sub.apiApproveStatus ==1){
        				 var aproStatus ='审核通过';
        			}else if (sub.apiApproveStatus ==0){
        				 var aproStatus ='正在审核中';
        			}else{
        				var aproStatus ='审核不通过';
        			};
        			var aproTime = new Date(sub.apiApproveStartTime).Format("yyyy-MM-dd");
        			itemsHtml += ' <tr class="ci-listTr" style="cursor:auto">'+
					' <td style="width: 12%;">' + sub.providerName + '</td>'+
					' <td style="width: 12%;">' + sub.apiName + '</td>'+
					' <td style="width: 12%;">' + sub.version + '</td>'+
					' <td style="width: 15%;">' +aproTime+ '</td>'+
					' <td style="width: 15%;">' + aproStatus + '</td>'+
					' <td style="width: 15%;">' + '<a href="'+ctx+'/lookAproApi?flowInstId='+sub.proInsId+'"><font color=red>查看</font></a>'+'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '+'<a href="'+ctx+'/trackProccess?flowInstId='+sub.proInsId+'"target=_blank"><font color=red>跟踪</font></a>'+'</td>'+'</tr>'
        		})(i);
        	}
        	$('#aproList').html(itemsHtml);
		}
	});
}

</script>
</head>
<body style="width:100%">
	<div class="content">
		<div style="margin: 0 13px 30px 13px;">
			<!--div >
				<div><h3><span>我的审核</span></h3></div>
			</div-->
			<div style="margin-bottom:10px">
				<!--div><span>API订阅工单申请审核信息</span></div><br-->
				<input id="subName" type="hidden" name="subscriber" value="${subscriber}" />
				<div class="col-md-3" style="padding-left:0">
					<span>审核状态：</span> 
					<select id="apiStatus" name="apiApproveStatus" >
						<option value="">请选择</option>
						<option value="2" <c:if test="${apiApproveStatus==1}">selected</c:if>>审核不通过</option>
						<option value="1" <c:if test="${apiApproveStatus==1}">selected</c:if>>审核通过</option>
						<option value="0" <c:if test="${apiApproveStatus==0}">selected</c:if>>正在审核中</option>
					</select>
				</div>
				<span>API名称：</span>
				<input id="apiName" type="text" name="apiName" value="${apiName}" />
				<input type="button" style="padding: 4px 10px;" class="btn btn-danger" onclick="loadSubscribeList();" value="查询"/>
			</div>
			<div>
				<div class="tab-content">
					<div role="tabpanel" class="tab-pane active" id="home">
						<table class="table table-bordered table-hover table-striped" style="font-size:13px;">
							<thead>
								<tr>
									<th>API提供者</th>
									<th>API名称</th>
									<th>版本</th>
									<th>创建时间</th>
									<th>审核状态</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody id="aproList"></tbody>
						</table>
					</div>
				</div>
				<div id="pagination"></div>
			</div>
		</div>
	</div>
</body>
</html>
